<%--
  Created by IntelliJ IDEA.
  User: 刘洋
  Date: 2019/9/19
  Time: 10:46
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
	<title>Login</title>
	<jsp:include page="${pageContext.request.contextPath}/layout/_imports.jsp"></jsp:include>
</head>
<body>
<jsp:include page="${pageContext.request.contextPath}/layout/_nav.jsp"></jsp:include>

<div class="container">
	<h1>欢迎来到考试系统</h1>

	<c:if test="${not empty user}">
		<h2>你的名字为:${user.name}</h2>
		<form action="${pageContext.request.contextPath}/item">
			<input type="hidden" name="state" value="getItemPage">
			<input type="hidden" name="nextId" value="0">
			<input type="submit" class="btn btn-primary" onclick="return confirm('${user.name},你真的确认了么？!')" value="确认考试">
			<button type="submit" class="btn btn-danger" id="logout">这不是我</button>
		</form>
	</c:if>
</div>

<script type="text/javascript">
    $("#logout").click(function () {
        $("form").append('<input type="hidden" name="state" value="u.logout">')
        $("form").attr('action', "/user");
        return confirm("真的不是你么？");
    });
</script>
</body>
</html>